﻿
@{
    ViewBag.Title = "HiddenTroubleAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>
        th {
            text-align: center;
            font-weight: bold;
        }

        td {
            text-align: center;
            vertical-align: middle;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="CheckFormController" ng-init="
     page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     PageName='@(Request.QueryString["PageName"].IsEmpty() ? "" : Request.QueryString["PageName"])';
     PlaceName='@(Request.QueryString["PlaceName"].IsEmpty() ? "" : Request.QueryString["PlaceName"])';
     RoomId='@(Request.QueryString["RoomId"].IsEmpty() ? "0" : Request.QueryString["RoomId"])';
     PlaceId='@(Request.QueryString["PlaceId"].IsEmpty() ? "0" : Request.QueryString["PlaceId"])';
     CheckTypeId='@(Request.QueryString["CheckTypeId"].IsEmpty() ? "0" : Request.QueryString["CheckTypeId"])';

     AddModel={};
     GetPlaceDepartment(PlaceId,AddModel);
     GetCheckTypeList(RoomId,PlaceId);
     AddModel.RoomId = RoomId;
     AddModel.FormNo = 'C'+'@DateTime.Now.ToString("yyMMddHHmmssfff")';
     AddModel.CheckTime = '@DateTime.Now.ToString("yyyy-MM-dd")';
     CheckItems=[];
     ImageCount = [0,1,2];
     FileList = [];
     ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />

			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="page-heading">
        <h1>{{PlaceName}}-检查登记</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主体业务</a></li>
        <li><a>场所安全</a></li>
        <li><a>场所检查</a></li>
        <li class="active"><a>检查登记</a></li>
    </ol>

    <div class="container-fluid">
        <div class="row">
            <form class="form-horizontal row-border">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading"><h2>检查登记</h2></div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>部门：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" ng-model="AddModel.DepartmentName" readonly />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>部位名称：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" ng-model="PlaceName" readonly />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>部门负责人：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" ng-model="AddModel.Manager" readonly />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>责任人：</label>
                                <div class="col-sm-3">
                                    <input type="text" class="form-control" ng-model="AddModel.ResponsibleName" readonly />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>检查日期：</label>
                                <div class="col-sm-3">
                                    @*<datepicker id="startTime" option="datetimeOption" format="L" ng-model="AddModel.CheckTime"></datepicker>*@
                                    <input type="text" class="form-control" ng-model="AddModel.CheckTime" disabled />
                                </div>
                                <label class="col-sm-1 control-label"><b style="color:red;"></b>检查类型：</label>
                                <div class="col-sm-3">
                                    <select ng-model="AddModel.CheckType" class="form-control" ng-change="GetCheckItemList(RoomId,AddModel.CheckType)">
                                        <option ng-repeat="x in CheckTypeList" value="{{x.Id}}">{{x.IntervalName}}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-12">
                                    <table class="table table-striped table-bordered table-hover" ng-show="!PageLoading">
                                        <thead>
                                            <tr>
                                                <th style="width:4%;vertical-align:middle;">序号</th>
                                                <th style="width:45%;vertical-align:middle;">检查内容</th>
                                                <th style="width:10%; ">
                                                    <p>
                                                        检查结果
                                                    </p>
                                                    <label class="radio-inline" ng-click="CheckAll(CheckItems,1);">
                                                        <input type="radio" name="CheckAll">正常
                                                    </label>
                                                    <label class="radio-inline" ng-click="CheckAll(CheckItems,0);">
                                                        <input type="radio" name="CheckAll"> 异常
                                                    </label>
                                                </th>
                                                <th style="width:5%;vertical-align:middle;">测量值</th>
                                                <th style="width:15%;vertical-align:middle;">照片</th>
                                                <th style="width:20%;vertical-align:middle;">备注</th>

                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td ng-show= "CheckItemList==null || CheckItemList.length==0" colspan="6" style="color:red;font-size:17px;">暂未分配检查任务</td>
                                            </tr>
                                            <tr ng-repeat="x in CheckItemList">
                                                <td ng-init="CheckItems[$index].SortBy=x.SortBy">{{$index+1}}</td>
                                                <td ng-init="CheckItems[$index].OptionId=x.OptionId" style="text-align:left;">{{x.CheckContent}}</td>
                                                <td>
                                                    <label class="radio-inline" ng-click="CheckItems[$index].Result=1">
                                                        <input type="radio" name="CheckItem_{{x.Id}}" id="Result_1_{{x.OptionId}}">正常
                                                    </label>
                                                    <label class="radio-inline" ng-click="CheckItems[$index].Result=0">
                                                        <input type="radio" name="CheckItem_{{x.Id}}" id="Result_0_{{x.OptionId}}">异常
                                                    </label>
                                                </td>
                                                <td>
                                                    <input type="text" ng-model="CheckItems[$index].DataValue" class="form-control" ng-show="x.IsValue" />
                                                    <b ng-show="!x.IsValue">一</b>
                                                </td>
                                                <td>
                                                    <div style="float:left;margin-left:10px;" ng-repeat="i in ImageCount" id="imagebox-{{x.OptionId}}_{{i}}">

                                                    </div>
                                                </td>
                                                <td><input type="text" class="form-control" ng-model="CheckItems[$index].Remark" /></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>

                            </div>
                        </div>
                        <div class="panel-footer">
                            <div class="col-md-4">
                            </div>
                            <div class="col-md-1">
                                <button class="btn-primary btn" ng-show="AddModel.CheckType!=null && @ViewBag.IsLeader==1" ng-click="SaveCheckForm(AddModel,CheckItems,FileList,PageName);">保存</button>
                            </div>
                            <div class="col-md-1">
                                <button class="btn-primary btn" ng-show="AddModel.CheckType!=null && @ViewBag.IsLeader==1" ng-click="SubmitCheckForm(AddModel,CheckItems,FileList,PageName);">提交</button>
                            </div>
                            <div class="col-md-1">
                                <a href="{{PageName}}?page={{page}}" class="btn-default btn">返回</a>
                            </div>
                            <div class="col-md-3">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>

    </div>

</div>


@section Js{
    <script src="~/Assets/js/libs/upload.js"></script>
    <script src="~/Assets/js/pg/CheckForm.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Assets/js/libs/moment.min.js"></script>
    <script src="~/Assets/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Assets/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Assets/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Assets/js/libs/fileinput.js"></script>
    <script src="~/Assets/js/libs/zh.js"></script>
}
